home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_vol_rocksmash.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  252 lines

  1. # Jones 3D Cog Script
  2. #
  3. # VOL_Rocksmash.cog
  4. #
  5. # This cog will roll a boulder into a wall and smash a hole through it.
  6. #
  7. # [CM]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14. message    startup
  15. message    entered
  16. message    pulse
  17. message    timer
  18. message    touched
  19.  
  20. thing    rock
  21.  
  22. thing    wallblastpos    
  23. thing    shotpos    
  24.     
  25.  
  26. thing    cam1
  27. thing    curCam    local
  28. thing    player    local
  29. thing    killCam        local
  30. thing    deadindy    nolink    local
  31.  
  32.  
  33. thing    rockpos0    
  34. thing    rockpos1    
  35. thing    rockpos2    
  36. thing    rockpos3    
  37. thing    rockpos4    
  38. thing    rockpos5    
  39. thing    rockpos6    
  40. thing    rockpos7    
  41.  
  42. thing    chunk1    local
  43. thing    chunk2    local
  44.  
  45. surface    triggersurf
  46. surface    wallface
  47. surface    walladj
  48.  
  49. sector    wallsect
  50.  
  51. int        blasted=0                                  local
  52. int        soundrun                                    local
  53. int        squished=0                                  local
  54. int        shudder=0                                   local
  55. int        rolling=0                                local
  56.  
  57.  
  58. int        position=0                                    local
  59.  
  60. template    dust=explosiondust                        local    
  61. template    debris=stoneshrapc_nc                    local    
  62. template    tempRef=indy_sh_actor                    local       
  63. template    tempRefKill=ghost                        local
  64. template    invis_shot=+dummy_bazooka                local
  65.  
  66.  
  67. keyframe    smashed=in_die_buckle.key                local
  68. keyframe    rockrun=gen_boulder.key                    local
  69.  
  70. sound        rockroll=pru_boulder_rolling_c.wav        local
  71. sound        rocksmash=pru_boulder_crash_c.wav        local
  72. sound        music=mus_gen_danger3.wav                local
  73. sound        sndDie=INXJ015.WAV                        local
  74.  
  75. vector        debvec1
  76. vector        debvec2
  77.  
  78. int            TIMERID_ROCKMOVE=1                        local
  79.  
  80. end
  81.  
  82. # ========================================================================================
  83.  
  84. code
  85.  
  86. startup:
  87.  
  88.     # initialize the player
  89.     player = GetLocalPlayerThing();
  90.     
  91.     # prep the wall face
  92.     SetSectorAdjoins(wallsect, 0);
  93.     SetFaceGeoMode(wallface, 4);
  94.     SetAdjoinFlags(walladj, 0x10);
  95.     return;
  96.  
  97. # ========================================================================================
  98.  
  99. entered:
  100.  
  101.     If ((GetSenderRef() == triggersurf) && (blasted == 0))    # indy enters the trigger face the first time
  102.         {
  103.             position= 0;
  104.             rolling = 1;
  105.             blasted = 1;
  106.             curCam = GetCurrentCamera();
  107.             
  108.             # take player control
  109.             StartCutScene(1);
  110.             SetActorFlags(player, 0x200000);
  111.             SetCameraLookInterp(2,0);
  112.             # jump to a camera to show the rock rolling
  113.             
  114.             SetCameraFocus(2, cam1);
  115.             SetCameraSecondaryFocus(2, rock);
  116.             SetCurrentCamera(2);
  117.  
  118.             # music cue
  119.             PlaySoundLocal(music, 1.0, 0.0, 0x0, 0);
  120.             
  121.             # start the screenshake and rock sounds
  122.             SetPulse(.05);
  123.             soundrun = PlaySoundLocal(rockroll, 2, 0, 0x1, 0);
  124.             rockrun = PlayKey(rock, rockrun, 1, 0x0, 0);
  125.             
  126.             # move the rock through it's positions
  127.             SetTimerEx(0.5, TIMERID_ROCKMOVE, 0, 0);
  128.             MoveThingtoPos(rock, GetThingPos(rockpos0[position]), 0.5);
  129.             Sleep(.5);
  130.             # return the camera
  131.             SetCurrentCamera(curCam);
  132.  
  133.             # restore player control
  134.             EndCutScene();
  135.             ClearActorFlags(player, 0x200000);
  136.             
  137.         }
  138.  
  139. return;
  140.         
  141.         
  142. # ========================================================================================
  143.  
  144. timer:
  145.  
  146.     if ( GetSenderID() != TIMERID_ROCKMOVE )
  147.         return;
  148.  
  149.     # Slam the rock to the desired current position
  150.     SetThingPosEx(rock, GetThingPos(rockpos0[position]), GetThingSector(rockpos0[position]));
  151.  
  152.     if (position == 5)
  153.     {
  154.         #MovetoFrame(rock, 8, 6.0);
  155.         shudder = 1;
  156.         CreateThing(invis_shot, shotpos);
  157.         Sleep(0.05);
  158.         SetSectorAdjoins(wallsect, 1);
  159.         ClearAdjoinFlags(walladj, 0x10);
  160.         SetFaceGeoMode(wallface, 0);
  161.         PlaySoundLocal(rocksmash, 6, 1, 0x0, 0);
  162.         
  163.     }
  164.     
  165.     if (position == 6)    
  166.     {
  167.         SetPulse(0);
  168.     }
  169.   
  170.     if (position == 7)
  171.     {
  172.         StopSound(soundrun, 2.0);
  173.         StopKey(rock, rockrun, 0.0);
  174.         SetThingMass(rock, 0);
  175.         rolling = 0;
  176.         return;
  177.     }
  178.  
  179.     # Increment postion counter and begin next move to pos anim
  180.     position = position + 1;
  181.     SetTimerEx(0.50, TIMERID_ROCKMOVE, 0, 0);
  182.     MoveThingtoPos(rock, GetThingPos(rockpos0[position]), 0.50);
  183.  
  184.     return;
  185.  
  186.  
  187. # ========================================================================================
  188.  
  189. pulse:
  190.  
  191.     If (shudder == 0)
  192.         {
  193.         SetPOVShake('0.0 0.0 0.001', '0.0 0.0 0.001', 80.0, 0.80);
  194.         }
  195.  
  196.     If (shudder == 1)
  197.         {
  198.         SetPOVShake('0.0 0.0 0.003', '0.0 0.0 0.003', 80.0, 0.80);
  199.         CreateThing(dust, wallblastpos); 
  200.         }
  201.     
  202.     
  203.     return;
  204.  
  205. # ========================================================================================
  206.  
  207. touched:
  208.     
  209.     If (rolling != 1) return;
  210.     if ((GetSenderRef() == rock) && (GetSourceRef() == player) && (squished == 0))
  211.     {            
  212.         squished=1;    
  213.         #PrintVector(GetThingPos(rock));
  214.         
  215.         #killCam = CreateThingAtPos
  216.         #    (tempRefKill, GetThingSector(rock), VectorAdd(GetThingPos(rock), '0 0 0.1'), '0 0 0');
  217.         
  218.         #CaptureThing(killCam);
  219.         #PrintVector(GetThingPos(killCam));
  220.         #SetCollideType(killCam, 0);
  221.         
  222.         
  223.     #    PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  224.         DamageThing(player, 1000.0, 0x1, player);
  225.     }
  226.     #    return;
  227.     #    SetThingFlags(player, 0x80000);
  228.     #    deadIndy = CreateThing(tempRef, player);
  229.     #    
  230.     #    CaptureThing(deadIndy);
  231.     #    ClearThingFlags(deadindy, 0x80000);
  232.         
  233.     #    SetCameraFocus(2, killCam);
  234.     #    SetCameraSecondaryFocus(2, deadindy);
  235.     #    SetCurrentCamera(2);
  236.         
  237.     #    PlayKey(deadindy, smashed, 4, 0x14, 0);
  238.     #    Sleep(0.75);
  239.     #    SetCollideType(rock, 0);
  240.     #}
  241.     
  242.                 
  243. return;
  244.  
  245. # ========================================================================================
  246.  
  247. end
  248.  
  249.  
  250.  
  251.  
  252.